<?php

/***  DOCUMENTATION LAYER

Ceo Sample Unit Test

Last Update: Aug 2007
  
DESCRIPTION
  this file provides a template for other simple unit tests.
  
NOTES
  $test_root dynamically sets root in order to keep tests working after
  they are moved to the __REPOSITORY directory
    
______________________________________________________________________________*/

$_tx0 = microtime();
$test_root = ( strpos(dirname(__FILE__), 'repository') === false ) ? '' : '../';


// Test Name
$test_name = 'ace hash test';

// Include Files
require_once($test_root . '../php_ceo/ext/ace/ace.class.php');

// Configure Test
$debug = 1;


// Test Procedure
$Test = new CeoAce($debug);

// plaintext
if ( !empty($_GET['hash']) ) $Test->hash_salt = trim($_GET['hash']);
if ( empty($_GET['pw']) ) $Test->print_d('set ?pw=VAL to get ace hash', 'black');
else
{
  $pw = $Test->_hash(trim($_GET['pw']));
  $hash = ( !empty($_GET['hash']) ) ? "+ hash [{$Test->hash_salt}] " : '';
  $Test->print_d("password [{$_GET['pw']}] {$hash}= <b>$pw</b>", 'green');
}

$Test->print_d('you can also set hash value with &hash=VAL -> ?pw=VAL&hash=VAL', 'blue');


// Footer
$_txn = microtime();
$stx = number_format(((substr($_txn,0,9)) + (substr($_txn,-10)) - (substr($_tx0,0,9)) - (substr($_tx0,-10))),4); 
echo "<h6>test '$test_name' complete in $stx s</h6>";
?>
